package com.zzty.demo.dao;


import com.zzty.demo.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


@Mapper
public interface UserDao {
    @Select("select * from user where openId=#{openId}")
    User getUserByOpenId(User user);

    @Select("select * from user where id=#{id}")
    User getUserById(User user);

    @Select("select * from user where id=#{id}")
    User getUserById1(@Param("id") Integer id);

    @Select("select * from user where name=#{name}")
    User getUserByName(User user);

    @Update("update  user set openId=#{openId} where name=#{name}")
    Integer updateOpenIdToUser(User user);

    @Select("select * from user")
    List<User> getAllUsers();

    @Select("select * from user where clazzid=#{id}")
    List<User> getUserByClazzId(@Param("id") Integer id);

    @Update("update user  set name=#{name},password=#{password},email=#{email} where id=#{id}")
    Integer updateUser(User user);

    @Update("update user set img=#{img} where id=#{id}")
    Integer updateImgByUserId(Integer id,String img);
}
